using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;

using ILRuntime.CLR.TypeSystem;
using ILRuntime.CLR.Method;
using ILRuntime.Runtime.Enviorment;
using ILRuntime.Runtime.Intepreter;
using ILRuntime.Runtime.Stack;
using ILRuntime.Reflection;
using ILRuntime.CLR.Utils;
using System.Linq;

namespace ILRuntime.Runtime.Generated
{
    unsafe class huqiang_Framework_Http_HWebClient_Binding
    {
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase method;
            FieldInfo field;
            Type[] args;
            Type type = typeof(huqiang.Framework.Http.HWebClient);
            args = new Type[]{};
            method = type.GetMethod("get_TimeOut", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_TimeOut_0);
            args = new Type[]{typeof(System.Int32)};
            method = type.GetMethod("set_TimeOut", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, set_TimeOut_1);
            args = new Type[]{};
            method = type.GetMethod("get_StatusCode", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_StatusCode_2);
            args = new Type[]{typeof(System.String)};
            method = type.GetMethod("GetFileLength", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetFileLength_3);
            args = new Type[]{typeof(System.Uri)};
            method = type.GetMethod("GetFileLength", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetFileLength_4);

            field = type.GetField("StartPos", flag);
            app.RegisterCLRFieldGetter(field, get_StartPos_0);
            app.RegisterCLRFieldSetter(field, set_StartPos_0);
            app.RegisterCLRFieldBinding(field, CopyToStack_StartPos_0, AssignFromStack_StartPos_0);
            field = type.GetField("Done", flag);
            app.RegisterCLRFieldGetter(field, get_Done_1);
            app.RegisterCLRFieldSetter(field, set_Done_1);
            app.RegisterCLRFieldBinding(field, CopyToStack_Done_1, AssignFromStack_Done_1);


            app.RegisterCLRCreateDefaultInstance(type, () => new huqiang.Framework.Http.HWebClient());
            app.RegisterCLRCreateArrayInstance(type, s => new huqiang.Framework.Http.HWebClient[s]);

            args = new Type[]{};
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);

        }


        static StackObject* get_TimeOut_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            huqiang.Framework.Http.HWebClient instance_of_this_method = (huqiang.Framework.Http.HWebClient)typeof(huqiang.Framework.Http.HWebClient).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.TimeOut;

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method;
            return __ret + 1;
        }

        static StackObject* set_TimeOut_1(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Int32 @value = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            huqiang.Framework.Http.HWebClient instance_of_this_method = (huqiang.Framework.Http.HWebClient)typeof(huqiang.Framework.Http.HWebClient).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.TimeOut = value;

            return __ret;
        }

        static StackObject* get_StatusCode_2(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            huqiang.Framework.Http.HWebClient instance_of_this_method = (huqiang.Framework.Http.HWebClient)typeof(huqiang.Framework.Http.HWebClient).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.StatusCode;

            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static StackObject* GetFileLength_3(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.String @url = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            huqiang.Framework.Http.HWebClient instance_of_this_method = (huqiang.Framework.Http.HWebClient)typeof(huqiang.Framework.Http.HWebClient).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.GetFileLength(@url);

            __ret->ObjectType = ObjectTypes.Long;
            *(long*)&__ret->Value = result_of_this_method;
            return __ret + 1;
        }

        static StackObject* GetFileLength_4(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Uri @uri = (System.Uri)typeof(System.Uri).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            huqiang.Framework.Http.HWebClient instance_of_this_method = (huqiang.Framework.Http.HWebClient)typeof(huqiang.Framework.Http.HWebClient).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.GetFileLength(@uri);

            __ret->ObjectType = ObjectTypes.Long;
            *(long*)&__ret->Value = result_of_this_method;
            return __ret + 1;
        }


        static object get_StartPos_0(ref object o)
        {
            return ((huqiang.Framework.Http.HWebClient)o).StartPos;
        }

        static StackObject* CopyToStack_StartPos_0(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Framework.Http.HWebClient)o).StartPos;
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method;
            return __ret + 1;
        }

        static void set_StartPos_0(ref object o, object v)
        {
            ((huqiang.Framework.Http.HWebClient)o).StartPos = (System.Int32)v;
        }

        static StackObject* AssignFromStack_StartPos_0(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Int32 @StartPos = ptr_of_this_method->Value;
            ((huqiang.Framework.Http.HWebClient)o).StartPos = @StartPos;
            return ptr_of_this_method;
        }

        static object get_Done_1(ref object o)
        {
            return ((huqiang.Framework.Http.HWebClient)o).Done;
        }

        static StackObject* CopyToStack_Done_1(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Framework.Http.HWebClient)o).Done;
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method ? 1 : 0;
            return __ret + 1;
        }

        static void set_Done_1(ref object o, object v)
        {
            ((huqiang.Framework.Http.HWebClient)o).Done = (System.Boolean)v;
        }

        static StackObject* AssignFromStack_Done_1(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Boolean @Done = ptr_of_this_method->Value == 1;
            ((huqiang.Framework.Http.HWebClient)o).Done = @Done;
            return ptr_of_this_method;
        }



        static StackObject* Ctor_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* __ret = ILIntepreter.Minus(__esp, 0);

            var result_of_this_method = new huqiang.Framework.Http.HWebClient();

            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }


    }
}
